﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

namespace 水费管理系统
{
    public partial class 打印 : Form
    {
        public enum id_打印类别 {档案,收费,抄表}; 
        public 打印()
        {
            InitializeComponent();
        }
        public 打印(id_打印类别 打印类别, int ID)
        {
            InitializeComponent();
            switch (打印类别)
            { 
                case id_打印类别.档案:
                    this.reportViewer1.LocalReport.ReportEmbeddedResource = "水费管理系统.报表.水表档案.rdlc";
                    this.reportViewer1.LocalReport.DataSources.Clear();
                    this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_基本信息", this.基本信息TableAdapter.GetDataByID(ID)));
                    break;
                case id_打印类别.抄表:
                    this.reportViewer1.LocalReport.ReportEmbeddedResource = "水费管理系统.报表.抄表.rdlc";
                    this.reportViewer1.LocalReport.DataSources.Clear();
                    this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_抄表", this.抄表TableAdapter.GetDataByID1(ID)));
                    break;
                case id_打印类别.收费:
                    this.reportViewer1.LocalReport.ReportEmbeddedResource = "水费管理系统.报表.收据.rdlc";
                    this.reportViewer1.LocalReport.DataSources.Clear();
                    this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_收费", this.收费TableAdapter.GetDataByID(ID)));
                    this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_抄表", this.抄表TableAdapter.GetDataByID(ID)));
                    break;
            }
        }

        private void 打印_Load(object sender, EventArgs e)
        {
            //// TODO: 这行代码将数据加载到表“dataSet1.抄表”中。您可以根据需要移动或移除它。
            //this.抄表TableAdapter.Fill(this.dataSet1.抄表);
            //// TODO: 这行代码将数据加载到表“dataSet1.收费”中。您可以根据需要移动或移除它。
            //this.收费TableAdapter.Fill(this.dataSet1.收费);
            //// TODO: 这行代码将数据加载到表“dataSet1.基本信息”中。您可以根据需要移动或移除它。
            //this.基本信息TableAdapter.Fill(this.dataSet1.基本信息);

            this.reportViewer1.RefreshReport();
            //this.reportViewer1.PrintDialog();
        }
    }
}